package com.lg.config;
import java.util.Properties;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.baomidou.mybatisplus.plugins.PerformanceInterceptor;
import com.github.pagehelper.PageHelper;
@Configuration
public class MybatisPlusConfig {
    /** 
    * @Description:  mybatis-plus SQL执行效率插件【生产环境可以关闭】
    * @param @return  
    * @return PerformanceInterceptor 
    * @throws 
    */ 
    @Bean
    public PerformanceInterceptor performanceInterceptor() {
    	PerformanceInterceptor performanceInterceptor=new  PerformanceInterceptor();
    	performanceInterceptor.setFormat(true);
        return performanceInterceptor;
    }
	
    @Bean
    public PageHelper pageHelper(){
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("offsetAsPageNum","true");
        properties.setProperty("rowBoundsWithCount","true");
        properties.setProperty("reasonable","true");
        properties.setProperty("dialect","mysql");    //配置mysql数据库的方言
        pageHelper.setProperties(properties);
        return pageHelper;
    }
}